//2009/08/19 14:57:51
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class FarFromPrimes
{
public:
    int count(int A, int B)
    {
        int ret = 0;
        for (int i=A; i<=B; i++)
            if (isfarfromprime(i))
                ret++;
        return ret;
    }
private:
    bool isprime(int n)
    {
        for (int i=2; i<n/2; i++)
            if (n % i == 0) return false;
        return true;
    }
    bool isfarfromprime(int n)
    {
        for (int i=n-10; i<=n+10; i++)
            if (isprime(i)) return false;
        return true;
    }
};
